home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / c_news / 16 / sets / setsourc / chsettyp.c < prev    next >
C/C++ Source or Header  |  1989-03-09  |  1KB  |  30 lines

  1. #include <stdio.h>
  2. #include <stdarg.h>
  3. #include "sets.h"
  4. /***************************************************************************/
  5.       int check_set_types(set *set1, set *set2)
  6. /***************************************************************************/
  7. /* Type checking is done here in three ways:
  8.        The base_types of destination and source must be the same and both
  9.    destination and source must have the same set_size and set tag.  UNLESS,
  10.    of course, one of the base_types is UNIVERSAL.
  11. */
  12. {
  13.     if(set1->base_type == set2->base_type &&
  14.        set1->set_size  == set2->set_size &&
  15.       set1->set_tag   == set2->set_tag)
  16.        return SUCCESS;
  17.     else if(set1->base_type == UNIVERSAL &&
  18.        set1->set_size  >= set2->set_size &&
  19.        set1->set_tag   == set2->set_tag)
  20.        return SUCCESS;
  21.     else if(set2->base_type == UNIVERSAL &&
  22.        set2->set_size  >= set1->set_size &&
  23.        set2->set_tag   == set1->set_tag)
  24.        return SUCCESS;
  25.     else
  26.        return FAILURE;
  27.  
  28. } /* end check_set_types */
  29.  
  30.